****** Table_10_5:  Independence
use data/Demo_book_country_3.dta, clear

*1) year of indep (linear model)
qui reg indep eur_pct_est_smooth britain spain france i.e_regionpol4 if el_excolony == 1, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_10_5.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "R-squared", e(r2)) addn("*** p<0.01, ** p<0.05, * p<0.1") se bdec(3) keep(eur_pct_est_smooth) replace
qui drop sample

*2) event history model
qui stset year, id(country_id) failure(sovereign_Cojocaru)
qui stcox eur_pct_est_smooth britain spain france i.e_regionpol4 if el_excolony == 1, vce(cluster country_id)
qui gen sample = e(sample)
qui tab country_id if sample == 1, nofreq
qui local countries=r(r)
qui tab year if sample == 1, nofreq
qui local years=r(r)
qui outreg2 using output/Table_10_5.doc, nor noni nonot nocon stats(coef tstat) addstat("Countries", `countries', "Years", `years', "Pseudo likelihood", e(ll)) addn("*** p<0.01, ** p<0.05, * p<0.1") keep(eur_pct_est_smooth) replace
qui drop sample
